home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / gcl-1.000 / gcl-1 / gcl-1.0 / h / eval.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-07  |  3.4 KB  |  130 lines

  1. /*
  2.  Copyright (C) 1994 M. Hagiya, W. Schelter, T. Yuasa
  3.  
  4. This file is part of GNU Common Lisp, herein referred to as GCL
  5.  
  6. GCL is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GCL is distributed in the hope that it will be useful, but WITHOUT
  12. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public 
  14. License for more details.
  15.  
  16. You should have received a copy of the GNU Library General Public License 
  17. along with GCL; see the file COPYING.  If not, write to the Free Software
  18. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. */
  21.  
  22. /*
  23.     eval.h
  24. */
  25.  
  26.  
  27. /*  C control stack  */
  28.  
  29. #define    CSSIZE        20000
  30. #define    CSGETA        4000
  31.  
  32. int *cs_org;
  33. int *cs_limit;
  34.  
  35.  
  36. /* we catch the segmentation fault and check to warn of c stack overflow */
  37. #ifdef AV
  38. #ifndef cs_check
  39. #define    cs_check(something) \
  40.     if ((int *)(&something) < cs_limit) \
  41.         cs_overflow()
  42. #endif
  43. #endif
  44. #ifdef MV
  45.  
  46.  
  47.  
  48. #endif
  49.  
  50. /*  bind template  */
  51.  
  52. struct bind_temp {
  53.     object    bt_var;
  54.     object    bt_spp;
  55.     object    bt_init;
  56.     object    bt_aux;
  57. };
  58.  
  59.  
  60. #define check_symbol(x) \
  61.     if (type_of(x) != t_symbol) \
  62.         not_a_symbol(x)
  63.  
  64. #define    check_var(x) \
  65.     if (type_of(x) != t_symbol || \
  66.         (enum stype)(x)->s.s_stype == stp_constant) \
  67.         not_a_variable(x)
  68.  
  69.  
  70. #define    eval_assign(to, form)  \
  71. {  \
  72.     object *old_top = vs_top;  \
  73.   \
  74.     eval(form);  \
  75.     to = vs_base[0];  \
  76.     vs_top = old_top;  \
  77. }
  78.  
  79.  
  80. #define MMcall(x)  \
  81.     ihs_check;  \
  82.     ihs_push(x);  \
  83.     (*(x)->cf.cf_self)();  \
  84.     ihs_pop()
  85.  
  86. #define MMccall(x, env_top)  \
  87.     ihs_check;  \
  88.     ihs_push(x);  \
  89.     (*(x)->cc.cc_self)(env_top);  \
  90.     ihs_pop()
  91.  
  92.  
  93. #define MMcons(a,d)    make_cons((a),(d))
  94.  
  95.  
  96. #define MMcar(x)    (x)->c.c_car
  97. #define MMcdr(x)    (x)->c.c_cdr
  98. #define MMcaar(x)    (x)->c.c_car->c.c_car
  99. #define MMcadr(x)    (x)->c.c_cdr->c.c_car
  100. #define MMcdar(x)    (x)->c.c_car->c.c_cdr
  101. #define MMcddr(x)    (x)->c.c_cdr->c.c_cdr
  102. #define MMcaaar(x)    (x)->c.c_car->c.c_car->c.c_car
  103. #define MMcaadr(x)    (x)->c.c_cdr->c.c_car->c.c_car
  104. #define MMcadar(x)    (x)->c.c_car->c.c_cdr->c.c_car
  105. #define MMcaddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_car
  106. #define MMcdaar(x)    (x)->c.c_car->c.c_car->c.c_cdr
  107. #define MMcdadr(x)    (x)->c.c_cdr->c.c_car->c.c_cdr
  108. #define MMcddar(x)    (x)->c.c_car->c.c_cdr->c.c_cdr
  109. #define MMcdddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_cdr
  110. #define MMcaaaar(x)    (x)->c.c_car->c.c_car->c.c_car->c.c_car
  111. #define MMcaaadr(x)    (x)->c.c_cdr->c.c_car->c.c_car->c.c_car
  112. #define MMcaadar(x)    (x)->c.c_car->c.c_cdr->c.c_car->c.c_car
  113. #define MMcaaddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_car->c.c_car
  114. #define MMcadaar(x)    (x)->c.c_car->c.c_car->c.c_cdr->c.c_car
  115. #define MMcadadr(x)    (x)->c.c_cdr->c.c_car->c.c_cdr->c.c_car
  116. #define MMcaddar(x)    (x)->c.c_car->c.c_cdr->c.c_cdr->c.c_car
  117. #define MMcadddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_cdr->c.c_car
  118. #define MMcdaaar(x)    (x)->c.c_car->c.c_car->c.c_car->c.c_cdr
  119. #define MMcdaadr(x)    (x)->c.c_cdr->c.c_car->c.c_car->c.c_cdr
  120. #define MMcdadar(x)    (x)->c.c_car->c.c_cdr->c.c_car->c.c_cdr
  121. #define MMcdaddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_car->c.c_cdr
  122. #define MMcddaar(x)    (x)->c.c_car->c.c_car->c.c_cdr->c.c_cdr
  123. #define MMcddadr(x)    (x)->c.c_cdr->c.c_car->c.c_cdr->c.c_cdr
  124. #define MMcdddar(x)    (x)->c.c_car->c.c_cdr->c.c_cdr->c.c_cdr
  125. #define MMcddddr(x)    (x)->c.c_cdr->c.c_cdr->c.c_cdr->c.c_cdr
  126.  
  127.  
  128. #define MMnull(x)    ((x)==Cnil)
  129.  
  130.